<?php

class ToplistView {
	public function doFacebookLoginButton( $loginUrl ) {
		$html = '';
		
		$html .= '<a href="' . $loginUrl . '"><img src="http://static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif"></a>';
		
		return $html;
	}

	public function doFacebookLogoutButton( $logoutUrl ) {
		$html = '';
		
		$html .= '<a href="' . $logoutUrl . '"><img src="http://static.ak.fbcdn.net/rsrc.php/z2Y31/hash/cxrz4k7j.gif"></a>';
		
		return $html;
	}

	public function doFacebookComments() {
		$html = '';
		
		$html .= '<div class="fb-comments" data-href="http://www.cedeskog.com/fbapp/" data-num-posts="10" data-width="500"></div><br />';
		
		return $html;
	}

	public function doFacebookLikeButton() {
		$html = '';
		
		$html .= '<div class="fb-like" data-send="false" data-width="450" data-show-faces="true" data-font="lucida grande"></div>';
		
		return $html;
	}

	public function doFacebookScript() {
		$html = '';
		
		$html .= '<script>'
				.'(function(d, s, id) {'
				.'var js, fjs = d.getElementsByTagName(s)[0];'
				.'if (d.getElementById(id)) {return;}'
				.'js = d.createElement(s); js.id = id;'
				.'js.src = "//connect.facebook.net/sv_SE/all.js#xfbml=1";'
				.'fjs.parentNode.insertBefore(js, fjs);'
				.'}( document, \'script\', \'facebook-jssdk\'));'
				.'</script>';
		
		return $html;
	}

	public function doToplist( $movies ) {
		$html = '';
		
		$html .= '<dl>';
		$html .= '  <dt><h1>MOVIEmeter Top 10</h1></dt>';
		$html .= '  <dd>';
		$html .= '    <ol>';
		foreach ( $movies as $movie ) {
			$html .= '      <li><a href="' . $movie['link'] . '">' . $movie['title'] . '</a></li>';
		}
		$html .= '    </ol>';
		$html .= '  </dd>';
		$html .= '</dl>';
		
		return $html;
	}
	
	public function isCanvas() {
		return isset( $_GET['canvas'] );
	}
}
